<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%-- <link href="<c:url value='/Team2CSS.css'/>" rel="stylesheet" type="text/css"/> --%>
<fmt:setBundle basename="Messages_en" />
<title> <fmt:message key="title"/> </title>
</head>
<body>
<form action="/JavaCA/search" method="post" >
<%@include  file="header.jsp" %>
<table>
<tr>
<td width=10%></td>
<td class="menuborder" width=15%>
<table id="content">
			<tr>
				<td><h2 id="header">MENU</h2></td>
			</tr>
			<tr>
				<td><a href="MakeABooking.jsp">Make a Booking</a></td>
			</tr>
			<tr>
				<td><a href="BookDetailsController">View Booking Details</a></td>
			</tr>
			<tr>
				<td><a href="BookingHistoryController">View Booking History</a></td>
			</tr>
			<tr>
				<td><a href="ManageStaff.jsp">Manage Staff</a></td>
			</tr>
			<tr>
				<td><a href="LoadFacility">Manage Facilities</a></td>
			</tr>
			<tr>
				<td><a href="Login.jsp">Sign Out</a>
				</td>
			</tr>
		</table>
</td>
<td width=65%>
        <h1><fmt:message key="label.facility"/></h1>
        <c:url var="url" scope="page" value="/setupPage.jsp">
        		<c:param name="Id" value=""/>
                <c:param name="name" value=""/>
                <c:param name="type" value=""/>
                <c:param name="description" value=""/>
                <c:param name="capacity" value=""/>
                <c:param name="insert" value="true"/>
        </c:url>
        <h3>Search By Facility Type</h3>
        <select name="type">
        <option ></option>
        <option value="Auditorium">Auditorium</option>
        <option value="Classroom">Classroom</option>
        <option value="MeetingRoom">MeetingRoom</option>
        <option value="DiscussionRoom">DiscussionRoom</option>
        <option value="MPH">MPH</option>
        </select>
        <input type="submit" value="Go">
        <a href="${url}"><fmt:message key="label.facility.add"/></a>
        <br/><br/>
         <table  border="1">
            <tr>
                <th><fmt:message key="label.facility.Id"/></th>
                <th><fmt:message key="label.facility.name"/></th>
                <th><fmt:message key="label.facility.type"/></th>
                <th><fmt:message key="label.facility.description"/></th>
                <th><fmt:message key="label.facility.capacity"/></th>                
                <th><fmt:message key="label.facility.edit"/></th>
                <th><fmt:message key="label.facility.delete"/></th>
            </tr>
            <c:forEach var="facility" items="${facilities}" varStatus="status">
<%--                 <tr class="${status.index%2==0?'even':'odd'}"> --%>
<%--                     <td>${status.index + 1}</td> --%>
			<tr>
                    <td >${facility.facilityID}</td>
                    <td >${facility.facilityName}</td>
                    <td >${facility.type}</td>
                    <td >${facility.description}</td>
                    <td >${facility.capacity}</td>
                    <td>
                        <c:url var="updurl" scope="page" value="/setupPage.jsp">
                            <c:param name="Id" value="${facility.facilityID}"/>
                            <c:param name="name" value="${facility.facilityName}"/>
                            <c:param name="type" value="${facility.type}"></c:param>
                            <c:param name="description" value="${facility.description}"/>
                            <c:param name="capacity" value="${facility.capacity}"></c:param>
                            <c:param name="update" value="true"/>
                        </c:url>
                        <a href="${updurl}"><fmt:message key="label.facility.edit"/></a>
                    </td>
                    <td>
                        <c:url var="delurl" scope="page" value="/deleteFacility">
                            <c:param name="facilityID" value="${facility.facilityID}"/>
                        </c:url>
                        <a href="${delurl}"><fmt:message key="label.facility.delete"/></a>
                    </td>
                </tr>
            </c:forEach>
        </table>
        </td>
<td width=10%></td>
</tr>
</table>
        <%@include  file="footer.jsp" %>
        
</form>
</body>
</html>